import request from '@/utils/request'

// 查询小程序配置列表
export function listProgramConfig(query) {
  return request({
    url: '/fun/programConfig/list',
    method: 'get',
    params: query
  })
}

// 查询小程序配置详细
export function getProgramConfig(configId) {
  return request({
    url: '/fun/programConfig/' + configId,
    method: 'get'
  })
}

// 新增小程序配置
export function addProgramConfig(data) {
  return request({
    url: '/fun/programConfig',
    method: 'post',
    data: data
  })
}

// 修改小程序配置
export function updateProgramConfig(data) {
  return request({
    url: '/fun/programConfig',
    method: 'put',
    data: data
  })
}

// 删除小程序配置
export function delProgramConfig(configId) {
  return request({
    url: '/fun/programConfig/' + configId,
    method: 'delete'
  })
}

// 获取小程序配置（匿名访问接口，用于小程序渲染）
export function getPublicProgramConfig(orgId, openStatus) {
  return request({
    url: '/fun/programConfig/public/config',
    method: 'get',
    params: {
      orgId: orgId,
      openStatus: openStatus
    }
  })
}
